namespace BepuPhysics.Constraints.Contact
{
    /// <summary>
    /// 直接引用解算器的接触约束数据的回调。
    /// </summary>
    public interface ISolverContactDataExtractor
    {
        /// <summary>
        /// 提供对凸面一体式接触约束的引用。约束数据位于直接参考的第一个通道中(矢量的插槽0)。
        /// </summary>
        /// <typeparam name="TPrestep">返回的前一步数据的类型。</typeparam>
        /// <typeparam name="TAcumulatedImPulses">返回的累计脉冲数据的类型。</typeparam>
        /// <param name="bodyHandle">约束引用的正文句柄。</param>
        /// <param name="prestep">与约束关联的前步数据。</param>
        /// <param name="Pulse">与约束关联的累计脉冲。</param>
        void ConvexOneBody<TPrestep, TAccumulatedImpulses>(BodyHandle bodyHandle, ref TPrestep prestep, ref TAccumulatedImpulses impulses)
            where TPrestep : struct, IConvexContactPrestep<TPrestep>
            where TAccumulatedImpulses : struct, IConvexContactAccumulatedImpulses<TAccumulatedImpulses>;

        /// <summary>
        /// 提供对凸面两体接触约束的引用。约束数据位于直接参考的第一个通道中(矢量的插槽0)。
        /// </summary>
        /// <typeparam name="TPrestep">返回的前一步数据的类型。</typeparam>
        /// <typeparam name="TAcumulatedImPulses">返回的累计脉冲数据的类型。</typeparam>
        /// <param name="bodyHandleA">约束引用的第一个正文句柄。</param>
        /// <param name="bodyHandleB">约束引用的第二个正文句柄。</param>
        /// <param name="prestep">与约束关联的前步数据。</param>
        /// <param name="Pulse">与约束关联的累计脉冲。</param>
        void ConvexTwoBody<TPrestep, TAccumulatedImpulses>(BodyHandle bodyHandleA, BodyHandle bodyHandleB, ref TPrestep prestep, ref TAccumulatedImpulses impulses)
            where TPrestep : struct, ITwoBodyConvexContactPrestep<TPrestep>
            where TAccumulatedImpulses : struct, IConvexContactAccumulatedImpulses<TAccumulatedImpulses>;


        /// <summary>
        /// 提供对非凸一体式接触约束的引用。约束数据位于直接参考的第一个通道中(矢量的插槽0)。
        /// </summary>
        /// <typeparam name="TPrestep">返回的前一步数据的类型。</typeparam>
        /// <typeparam name="TAcumulatedImPulses">返回的累计脉冲数据的类型。</typeparam>
        /// <param name="bodyHandle">约束引用的正文句柄。</param>
        /// <param name="prestep">与约束关联的前步数据。</param>
        /// <param name="Pulse">与约束关联的累计脉冲。</param>
        void NonconvexOneBody<TPrestep, TAccumulatedImpulses>(BodyHandle bodyHandle, ref TPrestep prestep, ref TAccumulatedImpulses impulses)
            where TPrestep : struct, INonconvexContactPrestep<TPrestep>
            where TAccumulatedImpulses : struct, INonconvexContactAccumulatedImpulses<TAccumulatedImpulses>;

        /// <summary>
        /// 提供对非凸两体接触约束的引用。约束数据位于直接参考的第一个通道中(矢量的插槽0)。
        /// </summary>
        /// <typeparam name="TPrestep">返回的前一步数据的类型。</typeparam>
        /// <typeparam name="TAcumulatedImPulses">返回的累计脉冲数据的类型。</typeparam>
        /// <param name="bodyHandleA">约束引用的第一个正文句柄。</param>
        /// <param name="bodyHandleB">约束引用的第二个正文句柄。</param>
        /// <param name="prestep">与约束关联的前步数据。</param>
        /// <param name="Pulse">与约束关联的累计脉冲。</param>
        void NonconvexTwoBody<TPrestep, TAccumulatedImpulses>(BodyHandle bodyHandleA, BodyHandle bodyHandleB, ref TPrestep prestep, ref TAccumulatedImpulses impulses)
            where TPrestep : struct, ITwoBodyNonconvexContactPrestep<TPrestep>
            where TAccumulatedImpulses : struct, INonconvexContactAccumulatedImpulses<TAccumulatedImpulses>;
    }

    // 主体引用需要很少的处理,因此在极其受限的用例中,能够避免它们可能会很有用。
    /// <summary>
    /// 直接引用解算器的接触约束数据的回调。仅包括预步距和脉冲数据。
    /// </summary>
    public interface ISolverContactPrestepAndImpulsesExtractor
    {
        /// <summary>
        /// 提供对凸面一体式接触约束的引用。约束数据位于直接参考的第一个通道中(矢量的插槽0)。
        /// </summary>
        /// <typeparam name="TPrestep">返回的前一步数据的类型。</typeparam>
        /// <typeparam name="TAcumulatedImPulses">返回的累计脉冲数据的类型。</typeparam>
        /// <param name="prestep">与约束关联的前步数据。</param>
        /// <param name="Pulse">与约束关联的累计脉冲。</param>
        void ConvexOneBody<TPrestep, TAccumulatedImpulses>(ref TPrestep prestep, ref TAccumulatedImpulses impulses)
            where TPrestep : struct, IConvexContactPrestep<TPrestep>
            where TAccumulatedImpulses : struct, IConvexContactAccumulatedImpulses<TAccumulatedImpulses>;

        /// <summary>
        /// 提供对凸面两体接触约束的引用。约束数据位于直接参考的第一个通道中(矢量的插槽0)。
        /// </summary>
        /// <typeparam name="TPrestep">返回的前一步数据的类型。</typeparam>
        /// <typeparam name="TAcumulatedImPulses">返回的累计脉冲数据的类型。</typeparam>
        /// <param name="prestep">与约束关联的前步数据。</param>
        /// <param name="Pulse">与约束关联的累计脉冲。</param>
        void ConvexTwoBody<TPrestep, TAccumulatedImpulses>(ref TPrestep prestep, ref TAccumulatedImpulses impulses)
            where TPrestep : struct, ITwoBodyConvexContactPrestep<TPrestep>
            where TAccumulatedImpulses : struct, IConvexContactAccumulatedImpulses<TAccumulatedImpulses>;


        /// <summary>
        /// 提供对非凸一体式接触约束的引用。约束数据位于直接参考的第一个通道中(矢量的插槽0)。
        /// </summary>
        /// <typeparam name="TPrestep">返回的前一步数据的类型。</typeparam>
        /// <typeparam name="TAcumulatedImPulses">返回的累计脉冲数据的类型。</typeparam>
        /// <param name="prestep">与约束关联的前步数据。</param>
        /// <param name="Pulse">与约束关联的累计脉冲。</param>
        void NonconvexOneBody<TPrestep, TAccumulatedImpulses>(ref TPrestep prestep, ref TAccumulatedImpulses impulses)
            where TPrestep : struct, INonconvexContactPrestep<TPrestep>
            where TAccumulatedImpulses : struct, INonconvexContactAccumulatedImpulses<TAccumulatedImpulses>;

        /// <summary>
        /// 提供对非凸两体接触约束的引用。约束数据位于直接参考的第一个通道中(矢量的插槽0)。
        /// </summary>
        /// <typeparam name="TPrestep">返回的前一步数据的类型。</typeparam>
        /// <typeparam name="TAcumulatedImPulses">返回的累计脉冲数据的类型。</typeparam>
        /// <param name="prestep">与约束关联的前步数据。</param>
        /// <param name="Pulse">与约束关联的累计脉冲。</param>
        void NonconvexTwoBody<TPrestep, TAccumulatedImpulses>(ref TPrestep prestep, ref TAccumulatedImpulses impulses)
            where TPrestep : struct, ITwoBodyNonconvexContactPrestep<TPrestep>
            where TAccumulatedImpulses : struct, INonconvexContactAccumulatedImpulses<TAccumulatedImpulses>;
    }

}
